import "package:ct_pa_majordomo/utils/request.dart";
import "package:dio/dio.dart";

class PreCheckInApi {

  /// 获取预登记列表
  /// pageNum 页码
  /// pageSize 每页条数
  /// checkInStart 开始时间
  /// checkInEnd 结束时间
  Future<Map> getPreCheckInList(queryParameters) async {
    Response response = await request.get(
      "apartment/pre/register/list",
      queryParameters: queryParameters,
    );
    return response.data ?? {};
  }

  /// 新增预登记信息
  Future<Map> addPreCheckIn(queryParameters) async {
    Response response = await request.post(
      "apartment/pre/register",
      data: queryParameters,
    );
    return response.data ?? {};
  }

  /// 修改预登记信息
  Future<Map> updatePreCheckIn(queryParameters) async {
    Response response = await request.put(
      "apartment/pre/register",
      data: queryParameters,
    );
    return response.data ?? {};
  }
  
  /// 审核预登记
  /// registerId 预登记id
  /// auditStatus 审核状态 1通过，0拒绝
  /// auditComment 审核备注
  Future<Map> auditPreCheckIn(registerId, queryParameters) async {
    Response response = await request.put(
      "apartment/pre/register/audit/$registerId",
      queryParameters: queryParameters,
    );
    return response.data ?? {};
  }

  // 分配房间
  /// registerId 预登记id
  /// roomId 房间id
  Future<Map> assignRoom(queryParameters) async {
    Response response = await request.put(
      "apartment/pre/register/check-in",
      data: queryParameters,
    );
    return response.data ?? {};
  }

  /// 获取预登记详情
  /// registerId 预登记id
  Future<Map> getPreCheckInDetail(registerId) async {
    Response response = await request.get(
      "apartment/pre/register/$registerId",
    );
    return response.data ?? {};
  }
}

PreCheckInApi preCheckInApi =  PreCheckInApi();